import request from "@/utils/request";

// 查询宠物列表
export function listRecipe(query) {
  return request({
    url: "/cookbook/recipe/list",
    method: "get",
    params: query,
  });
}

// 获取宠物详情
export function getRecipe(recipeId) {
  return request({
    url: `/cookbook/recipe/${recipeId}`,
    method: "get",
  });
}

// 获取宠物评论
export function getRecipeComments(recipeId) {
  return request({
    url: `/cookbook/comment/list`,
    method: "get",
    params: {
      recipeId: recipeId,
    },
  });
}

// 提交宠物评论
export function addComment(data) {
  return request({
    url: "/cookbook/comment",
    method: "post",
    data: data,
  });
}

// 申请领养
export function applyAdoption(data) {
  return request({
    url: "/cookbook/recipe/adopt",
    method: "post",
    data: data,
  });
}

// 获取我的领养申请列表
export function getMyAdoptions(query) {
  return request({
    url: "/cookbook/adoption/my-list",
    method: "get",
    params: query,
  });
}

// 取消领养申请
export function handleCancelAdoption(adoptionId) {
  return request({
    url: `/cookbook/adoption/cancel/${adoptionId}`,
    method: "put",
  });
}

// 完成领养流程
export function handleCompleteAdoption(adoptionId) {
  return request({
    url: `/cookbook/adoption/complete/${adoptionId}`,
    method: "put",
  });
}
